package com.m7.netty;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author likai
 * @date 2020/4/8 9:34
 * @email likai@7moor..com
 * @desc
 */
public class WebSocketClient {

    private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketClient.class);


    public static void main(String[] args){
//        LOGGER.info("接受参数：{}", JSONObject.toJSONString(args));
//        if(args==null||args.length!=3){
//            LOGGER.error("启动参数错误");
//            return;
//        }
        try {
//            String ip = args[0];
//            String port = args[1];
//            String connections = args[2];
        String ip = "127.0.0.1";
        String port = "7073";
        String connections = "100";
        Thread t1 = new Thread(()->{
            WebSocketConnect run = new WebSocketConnect("ws://" + ip + ":" + port + "/webSocket", new Integer(connections));
            try {
                run.connect();
            } catch (Exception e) {
                e.printStackTrace();
            }
        },"t1");

            Thread t2 = new Thread(()->{
                WebSocketConnect run = new WebSocketConnect("ws://" + ip + ":" + port + "/webSocket", new Integer(connections));
                try {
                    run.connect();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            },"t2");

            t1.start();t2.start();



        }catch (Exception e){
            LOGGER.error("启动异常：{}",e);
        }
    }
}
